package com.mazaiting.classfile.constant.info;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;

/**
 * 方法句柄信息
 *
 * @author mazaiting
 * @since 2021/8/12
 */
public class ConstantMethodHandleInfo extends ConstantInfo{
    /**
     * 引用
     */
    private byte referenceKind;
    /**
     * 引用索引 无符号 u2
     */
    private int referenceIndex;

    public ConstantMethodHandleInfo(ConstantPool pool, short tag) {
        super(pool, tag);
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.referenceKind = reader.readU1();
        this.referenceIndex = reader.readU2ToUnsignedShort();
    }

    @Override
    public String toString() {
        return "ConstantMethodHandleInfo{" +
                "referenceKind=" + referenceKind +
                ", referenceIndex=" + referenceIndex +
                '}';
    }
}


















